/**
 * [baseExport 客户端平台判断]
 * @type {Object}
 */
const baseExport = {
    platform: () => window.navigator.platform,                                                                      // 当前平台
    ispc: () => /Win32|Win64|MacIntel|Linux i686|Linux x86_64/.test(window.navigator.platform),                     // pc浏览器
    // this was copy from qq
    _isPhone: () => /AppleWebKit.*Mobile/i.test(window.navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(window.navigator.userAgent)),
    isPhoneWebkit: () => /Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(window.navigator.userAgent),
    isPad: () => /iPad/i.test(window.navigator.userAgent),
    isAndroid: () => /android/i.test(window.navigator.userAgent) || ~window.navigator.userAgent.indexOf('Linux'),   // android
    isIos: () => /(iPhone|iPad|iPod|iOS)/i.test(window.navigator.userAgent),    // ios
    isWeixin: () => ~window.navigator.userAgent.indexOf('MicroMessenger'),      // 微信浏览器
    isQQ: () => ~window.navigator.userAgent.indexOf('QQ'),                      // 手机qq
    isUC: () => ~window.navigator.userAgent.indexOf('UCBrowser'),               // uc浏览器
    isQQBrower: () => ~window.navigator.userAgent.indexOf('MQQBrowser'),        // qq浏览器
    isAndroidHi: () => ~window.navigator.userAgent.indexOf('baiduhi_android'),  // 百度hi安卓
    isIOSHi: () => ~window.navigator.userAgent.indexOf('baiduhi'),      // 百度hi
    isFirefox: () => ~window.navigator.userAgent.indexOf('Firefox'),    // 火狐浏览器
    isIE: () => /msie/.test(window.navigator.userAgent),                // IE浏览器
    isSafari: () => ~window.navigator.userAgent.indexOf('Safari'),      // safari浏览器
    isShouBai: () => ~window.navigator.userAgent.indexOf('Baidu')       // 手百浏览器
};
const _export = Object.assign({
    isPhone: () => baseExport._isPhone() && baseExport.isPhoneWebkit(), // 是否是手机
    isPhoneOther: () => baseExport._isPhone() && !baseExport.isPhoneWebkit(),   // 是否是其他手机
    isPc: () => !(baseExport._isPhone() && baseExport.isPhoneWebkit())          // 是否是PC
}, baseExport);
/**
 * [exports 浏览器平台]
 * @type {Object}
 */
module.exports = _export;

export let isWeixin = _export.isWeixin;
export let isIos = _export.isIos;
export let isAndroid = _export.isAndroid;
export let isPhone = _export.isPhone;
export let isIE = _export.isIE;
export let isPc = _export.isPc;
export let isSafari = _export.isSafari;
export let isUC = _export.isUC;
export let isQQBrower = _export.isQQBrower;
